#!/bin/sh

start() {
	printf "Starting netService: "
	start-stop-daemon -S -m -b -p /var/run/netService.pid \
		--exec /opt/x1plus/bin/netService_patch \
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
	printf "Stopping netService: "
	start-stop-daemon -K -q -p /var/run/netService.pid
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
	stop
    sleep 1
	start
}

if [ ! -d "/usr/share/wpa_supplicant" ]; then
  mkdir /usr/share/wpa_supplicant
fi

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?
